<?php
namespace Mobile\Controller;
use Think\Controller;
use Common\Model\Movie;

class OrderController extends Controller {
    public function index(){
        $id=session('member');
        $model=D('Order');
        $list=$model->getAll($id);
        foreach($list as $k=>$v)
        {
            $list[$k]['son']=M('order_item')->where(['order_id'=>$v['oid']])->find();
            $list[$k]['son']['seat_row']= explode(',',$list[$k]['son']['seat_row']);
            $list[$k]['son']['seat_column']=explode(',',$list[$k]['son']['seat_column']);
            //var_dump($list[$k]['son']);exit;
            $list[$k]['mtime']=date('Y-m-d',$v['mtime']);
            $list[$k]['mlang']=Movie::langAlias($v['mlang']);
            $list[$k]['oid']=mt_rand(11111111,99999999);
            //放映状态处理
            $t=M('screening')->where(['id'=>$v['osid']])->find()['showtime'];
            $list[$k]['status'] = (time() < $t)?'未放映':'已放映';
        }
        //var_dump($list);exit;
        $this->assign('list',$list);
        $this->display();
    }
}

